<!DOCTYPE html>
<html lang="en">
<body>
	<a>jQuery</a>
	<script
		src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script>
		if (jQuery('a').get(0)) { // Is there an element in the set?     
			jQuery('a').attr('href', 'http://www.jquery.com');
		}
		if (jQuery('a').length) { // Check the length of the set. Can also use .size()     
			jQuery('a').attr('title', 'jQuery');
		}
	</script>
</body>
</html>